import { Component, OnInit, OnDestroy } from '@angular/core';
import { Fuhao } from './fuhao';
import { ActivatedRoute } from '@angular/router';
import { FuhaoService } from './fuhao.service';


@Component({
	selector: 'my-fuhao-detail',
	
	templateUrl: 'app/fuhao-detail.component.html'
})
export class FuhaoDetailComponent implements OnInit, OnDestroy{
      fuhao: Fuhao;
      sub: any;
      constructor(
      private fuhaoService: FuhaoService,
      private route: ActivatedRoute
  ) {}
	    ngOnInit() {
        this.sub = this.route.params.subscribe(params => {
        let id = +params['id'];
        this.fuhaoService.getFuhao(id)
         .then(fuhao => this.fuhao = fuhao);
    });
  }
    ngOnDestroy() {
      this.sub.unsubscribe();
    }
    goBack() {
      window.history.back();
    }

}